package com.example.tanhuanapp.controller;

import com.example.tanhuanapp.pojo.vo.PicUploadResult;
import com.example.tanhuanapp.server.PicUploadServer;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author IT空门_门主
 * @date 2024/1/11
 */
@RestController
@RequestMapping("pic/upload")
@Api(tags = "图片上传")
public class PicUploadController {
    @Autowired
    private PicUploadServer picUploadServer;

    /**
     * 上传照片
     * @param multipartFile
     * @return
     */
    @PostMapping
    @ResponseBody
    public PicUploadResult upload(@RequestParam("file") MultipartFile multipartFile) {
        return this.picUploadServer.upload(multipartFile);
    }
}
